Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move tribe to a module #25778

Merged
merged 12 commits into from
Jul 28, 2017
Merged

Conversation

ywelsch
Copy link
Contributor

@ywelsch ywelsch commented Jul 18, 2017

This PR moves tribe to a module, stripping core from the tribe functionality. If desired, we could even make tribe a plugin instead of a module.

@ywelsch ywelsch force-pushed the enhance/move-tribe-to-plugin branch from e039323 to 92b07cd Compare July 18, 2017 16:28
@ywelsch ywelsch requested a review from s1monw July 24, 2017 10:52
@s1monw
Copy link
Contributor

s1monw commented Jul 25, 2017

If desired, we could even make tribe a plugin instead of a module.

I think a module is fine here we should have done the move to a plugin earlier we are late in to the game here.

Copy link
Contributor

@s1monw s1monw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some suggestions and asks. I love this effort it makes core so much cleaner and settigns handling is so much improved.

@@ -920,8 +908,23 @@ protected SearchService newSearchService(ClusterService clusterService, IndicesS
return customNameResolvers;
}

/** Constructs an internal node used as a client into a cluster fronted by this tribe node. */
protected Node newTribeClientNode(Settings settings, Collection<Class<? extends Plugin>> classpathPlugins, Path configPath) {
public static class NodeBuilder {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need this additional class? it's seem like users can provide all the stuff at once to the newNode method?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this entire construct we can just subclass Node.java in the plugin / module and create a node via this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To play nicely with the MockNode concept used by the tests, we cannot just create the Node instance ourselves. However, by removing Guice injection, I've just replaced this class by a BiFunction<Settings, Path>.

@@ -218,17 +155,31 @@ public static Settings processSettings(Settings settings) {

private final NamedWriteableRegistry namedWriteableRegistry;

public TribeService(Settings settings, Path configPath, ClusterService clusterService, final String tribeNodeId,
NamedWriteableRegistry namedWriteableRegistry, BiFunction<Settings, Path, Node> clientNodeBuilder) {
@Inject
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I strongly believe we should not add any new @Inject anywhere in the codebase. we need to find a different way to do this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to unguice it in 2025150


@Override
public Collection<Class<? extends LifecycleComponent>> getGuiceServiceClasses() {
return Collections.singleton(TribeService.class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to initialize it via guice, is there anything we can do about this? I think this is a blocker if we are adding inject annotations anywhere

@@ -527,6 +517,10 @@ protected Node(final Environment environment, Collection<Class<? extends Plugin>
}
}

public void addOnStartedListener(Runnable runnable) {
onStartedListeners.add(runnable);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our plugin API on the node level is pull based not push. Can we add a method to pull these from ClusterPlugin.java that way we are consistent and we fully control who calls this method.

@ywelsch ywelsch requested a review from s1monw July 25, 2017 15:58
Copy link
Contributor

@s1monw s1monw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment LGTM otherwise

NamedXContentRegistry xContentRegistry) {
NamedXContentRegistry xContentRegistry, Environment environment,
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
BiFunction<Settings, Path, Node> clientNodeBuilder) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should not make this a first class citizen. Instead I suggest we remove the Node#newNode entirely and add a MockTribePlugin class that passes such a function that delegates to / creates a MockNode. Given that tribe goes away I think that is the right tradeoff. WDYT?

@ywelsch ywelsch requested a review from s1monw July 26, 2017 20:05
Copy link
Contributor

@s1monw s1monw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thank you for all the extra iterations. good change!

@ywelsch ywelsch merged commit 1a01514 into elastic:master Jul 28, 2017
@ywelsch
Copy link
Contributor Author

ywelsch commented Jul 28, 2017

Thanks @s1monw

ywelsch added a commit that referenced this pull request Jul 28, 2017
This commit moves tribe to a module, stripping core from the tribe functionality.
ywelsch added a commit that referenced this pull request Jul 28, 2017
This commit moves tribe to a module, stripping core from the tribe functionality.
@lcawl lcawl removed the v6.1.0 label Dec 12, 2017
martijnvg pushed a commit to martijnvg/elasticsearch that referenced this pull request Jan 31, 2018
martijnvg pushed a commit that referenced this pull request Feb 5, 2018
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants